<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once ('PrunusTable.php');
require_once ('PrunusRelation.php');

class PrunusTblPages extends PrunusTable {
  public function __construct() {
    $columns = array ('pag_id'         => array('flags'=>'lg')
                     ,'pag_identifier' => array('flags'=>'lgiu')
                     ,'pag_title'      => array('flags'=>'lgiu')
                     ,'pag_public'     => array('flags'=>'lgiu')
                     ,'pag_alive'      => array('flags'=>' gi')
                     );
    parent::__construct('pr_pages', $columns, 'pag_id','pag_alive');
    
    $columnsPermisosRelation = array ('per_id'      => array('flags'=>'l')
                                     ,'per_usu'     => array('flags'=>'li', 'parent'=>array('tableName'=>'pr_usuarios', 'idColumnName'=>'usu_id', 'nameColumnName'=>'usu_name', 'aliveColumnName'=>'usu_alive', 'duplicates' => FALSE, 'optionalValue' => 0 ))
                                     ,'per_rol'     => array('flags'=>'li', 'parent'=>array('tableName'=>'pr_roles', 'idColumnName'=>'rol_id', 'nameColumnName'=>'rol_name', 'aliveColumnName'=>'rol_alive', 'duplicates' => FALSE, 'optionalValue' => 0 ))
                                     //,'per_pag'     => array('flags'=>'li', 'parent'=>array('tableName'=>'pr_pages', 'idColumnName'=>'pag_id', 'nameColumnName'=>'pag_name', 'aliveColumnName'=>'pag_alive', 'duplicates' => FALSE ))
                                     ,'per_pag'     => array('flags'=>'l')
                                     ,'per_permiso' => array('flags'=>'li')
                                     );
    $relPermisos = new PrunusRelation('pr_permisos', 'per_id', null, 'per_pag', $this, $columnsPermisosRelation);
    parent::addRelation('permisos', $relPermisos);
  }
  
}
